<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父子组件通信</title>
    <script src="./js/vue.js"></script>
</head>
<body>

<div id="app">
    <!--将数据与属性绑定，传给子组件模板-->
    <cpn1 :cmovies="movies"  :cbook="book"></cpn1>
</div>

<!--声明子组件模板-->
<template id="tmp">
    <div>
        <h2>{{cmovies}}</h2>
        <h2>{{cbook}}</h2>
    </div>
</template>


<script>
    /*声明子组件*/
    const cpn1 = {
        template: "#tmp",
        props:['cmovies','cbook'],/*声明组件属性*/
        data(){
            return{}
        }
    };

    const vm = new Vue({
        el: "#app",
        data:{
            movies: ["动物世界","天气之子"],
            book: "计算机组成原理"
        },
        /*绑定子组件*/
        components:{
            cpn1
        }
    })
</script>
</body>
</html>